package com.homegoods.videomodule.presenter;

import com.alibaba.fastjson.JSON;
import com.homegoods.classify.model.Constant;
import com.homegoods.classify.model.VideoConstant;
import com.homegoods.videomodule.VideoApiUtils;
import com.homegoods.videomodule.model.FreedomCommunityModel;
import com.kedll.library.mvp.AbstractRefreshPresenter;
import com.kedll.library.mvp.RefreshingView;

import java.util.List;
import java.util.Random;

import io.reactivex.Observable;

/**
 * @author QiQi
 * @description 免费社区Presenter层
 */
public class FreedomCommunityPresenter extends AbstractRefreshPresenter {
    private int pos = 1;

    public FreedomCommunityPresenter(RefreshingView view) {
        super(view);
    }

    @Override
    protected void fetchData(boolean isLoadMore) {
        if (isLoadMore) {
            pos++;
        }
        VideoApiUtils.getCommunityVideo(pos, subModelList -> {
            List<FreedomCommunityModel> list = JSON.parseArray(subModelList.getItems(), FreedomCommunityModel.class);
            parserData(isLoadMore, list);
        }, throwable -> {

        });


    }

}